package com.jeasonzhao.report.exceptions;

import com.jeasonzhao.report.msg.Message;
import com.jeasonzhao.report.model.Report;
import com.jeasonzhao.report.model.ReportParam;

public class ReportParameterException extends SQLReportException
{
    private static final long serialVersionUID = 1L;
    public ReportParameterException(Object ...objs)
    {
        super(objs);
    }

    public ReportParameterException(Throwable t,Object ...objs)
    {
        super(t,objs);
    }

    @Message(
        {"zh_cn","报表{0}的必选参数{1}没有设置，不能进行查询"
        ,"en","Report {0} could not run query, parameter {1} has not been set."})
    public static class ParameterNotSet extends ReportParameterException
    {
        private static final long serialVersionUID = 1L;

        public ParameterNotSet(Report report,ReportParam param)
        {
            super(report,param);
        }
        public ParameterNotSet(Report report,String param)
        {
            super(report,param);
        }

    }

    @Message(
        {"zh_cn","报表{0}的必选参数{1}没有设置默认参数值，不能进行查询"
        ,"en","Report {0} could not run query, parameter {1} has not been set，default value needed."})
    public static class ParameterScriptNeeded extends ReportParameterException
    {
        private static final long serialVersionUID = 1L;

        public ParameterScriptNeeded(Report report,ReportParam param)
        {
            super(report,param);
        }
    }

    @Message(
        {"zh_cn","报表{0}参数{1}的脚本\"{2}\"分析错误"
        ,"en","the parameter {1} for the report {0} encountered a script parse error, the script is \"{2}\""})
    public static class ParamterScriptError extends ReportParameterException
    {
        private static final long serialVersionUID = 1L;

        public ParamterScriptError(Report report,ReportParam param,String strScript,Throwable t)
        {
            super(t,report,param,strScript);
        }
    }
}
